-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose sandbox properties via IPC JSON, criteria, title format #8521
Conversation
270600d
to
f4af2ca
Compare
If the value is \_\_focused\_\_, then the sandbox engine must be the same as | ||
that of the currently focused window. | ||
|
||
*sandbox_app_id* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of wondering whether we should expose this, or whether we should always prefer the sandbox-provided app ID over the one provided by the sandboxed client.
(IIRC GNOME allows org.libreoffice.Writer
if the sandbox app ID is org.libreoffice
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sandbox app_id
is defined to be engine-specific and may have an entirely different meaning.
For example, consider a system container (Docker, LXC, etc.) where the wayland socket / security context is associated with more than one application:
sandbox_engine
= "org.docker"sandbox_app_id
= "my-docker-container-2"app_id
= multiple, different per application
I'm not sure even that "Flatpak application ID" is equivalent to app_id
(for that specific engine).
See #8521 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point! Perhaps one could argue that any sandbox engine sending metadata through the security-context protocol is Wayland-aware (because it has to add support for that specific protocol)? Docker/LXC don't support Wayland apps out-of-the-box, so will not provide these app IDs which don't match xdg-shell. However, as you said nothing prevents a sandbox engine from having a completely different scheme for app IDs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main point is that there exist use cases where a single wayland socket / security context must support multiple arbitrary applications, making it impossible to set sandbox_app_id
(a single value for the security context and all associated views) in a way which is compatible with app_id
(potentially different per view).
For example, a system-level container (e.g. docker run 'my-ubuntu-container-3'
) could start a terminal, browser, and media player via a single wayland socket / security context.
Flatpak (and other application-level container tools) are a special case where only one application is expected to be associated with a given security context (but again, I'm not sure that's completely accurate).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System-level containers are less secure than per-app containers, because granted permissions apply to the whole container. That is, if a sandboxed app obtains a permission, all other apps in the container can abuse it.
But yeah, indeed, we don't want to prevent one from running containers with multiple apps in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the whole this looks good to me, added a few comments!
(Thanks for rebasing on top of my criteria changes!)
I was curious how other compositors are using and/or exposing security context metadata and did some research. Naming Convention
Metadata Usage
Research Summary
Notes and ReferencesCOSMIC
Hyprland
Jay
KWin
mutter
niri
PipeWire
|
f4af2ca
to
69b4a1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for doing the research!
This LGTM, will wait for a bit before merging just in case somebody else has objections.
Thanks! |
Rebase and update of #7187.
Add sandbox properties to IPC JSON, criteria, and title format:
sandbox_engine
sandbox_app_id
sandbox_instance_id
These properties may be set by sandbox engines (e.g.
flatpak
) via the security context protocol: https://wayland.app/protocols/security-context-v1.Example Usage
Prepend sandbox properties to window title when sandbox engine is set:
Testing
Launch an app via
flatpak
:Observe JSON layout tree via
swaymsg -r -t get_tree
:Observe pretty layout tree via
swaymsg -p -t get_tree
:Observe window title when configured as shown above: